<%@page import="org.eclipse.football.League"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>List of Teams</title>
</head>
<body>
<%
// Get the league from the session*
League league = (League) session.getValue("league");
if(league == null){
	// If the league is null instantiate a new one
	league = new League();
}

// Set the league in the session
session.putValue("league", league);%>

<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Team</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="25"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="Passing Yards" value="Passing Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="Passing Touchdowns" value="Passing Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="Interceptions" value="Interceptions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Passing 2pt Conversions" value="Passing 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="Rushing Yards" value="Rushing Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Rushing Touchdowns" value="Rushing Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="6"></input>
<input type="submit" name="Rushing 2pt Conversions" value="Rushing 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="7"></input>
<input type="submit" name="Receiving Yards" value="Receiving Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="8"></input>
<input type="submit" name="Receiving Touchdowns" value="Receiving Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="9"></input>
<input type="submit" name="Receiving 2pt Conversions" value="Receiving 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="10"></input>
<input type="submit" name="Fumbles" value="Fumbles"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="11"></input>
<input type="submit" name="Return Touchdowns" value="Return Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="12"></input>
<input type="submit" name="Defensive Touchdowns" value="Defensive Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="13"></input>
<input type="submit" name="Defensive Interceptions" value="Defensive Interceptions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="14"></input>
<input type="submit" name="Fumbles Recovered" value="Fumbles Recovered"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="15"></input>
<input type="submit" name="Sacks" value="Sacks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="16"></input>
<input type="submit" name="Blocked Kicks" value="Blocked Kicks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="17"></input>
<input type="submit" name="Safeties" value="Safeties"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="18"></input>
<input type="submit" name="Points Allowed" value="Points Allowed"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="19"></input>
<input type="submit" name="Yards Allowed" value="Yards Allowed"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="20"></input>
<input type="submit" name="PAT Made" value="PAT Made"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="21"></input>
<input type="submit" name="FG Made (0-39)" value="FG Made (0-39)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="22"></input>
<input type="submit" name="FG Made (40-49)" value="FG Made (40-49)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="23"></input>
<input type="submit" name="FG Made (50+)" value="FG Made (50+)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_team" method="post">
<input type="hidden" name="type" value="24"></input>
<input type="submit" name="FG Missed" value="FG Missed"></input>
</form>
</th>
</tr>

<c:forEach items="${league.teams}" var="team">
<tr>
<td>
<form action="/FootballStats/pick_team" method="post">
<input type="hidden" name="name" value="${team.getName() }"></input>
<input type="submit" name="PickTeam" value="${team.getName() }"></input>
</form>
</td>
<td>
<c:out value="${team.calculatePoints() }"/>
</td>
<td>
<c:out value="${team.getPassYds() }"/>
</td>
<td>
<c:out value="${team.getPassTds() }"/>
</td>
<td>
<c:out value="${team.getPicks() }"/>
</td>
<td>
<c:out value="${team.getPass2pt() }"/>
</td>
<td>
<c:out value="${team.getRushYds() }"/>
</td>
<td>
<c:out value="${team.getRushTds() }"/>
</td>
<td>
<c:out value="${team.getRush2pt() }"/>
</td>
<td>
<c:out value="${team.getRecYds() }"/>
</td>
<td>
<c:out value="${team.getRecTds() }"/>
</td>
<td>
<c:out value="${team.getRec2pt() }"/>
</td>
<td>
<c:out value="${team.getFumbles() }"/>
</td>
<td>
<c:out value="${team.getRetTds() }"/>
</td>
<td>
<c:out value="${team.getDefTds() }"/>
</td>
<td>
<c:out value="${team.getDefPicks() }"/>
</td>
<td>
<c:out value="${team.getDefFumbles() }"/>
</td>
<td>
<c:out value="${team.getSacks() }"/>
</td>
<td>
<c:out value="${team.getBlocks() }"/>
</td>
<td>
<c:out value="${team.getSafeties() }"/>
</td>
<td>
<c:out value="${team.getPA() }"/>
</td>
<td>
<c:out value="${team.getYA() }"/>
</td>
<td>
<c:out value="${team.getPAT() }"/>
</td>
<td>
<c:out value="${team.getFG0() }"/>
</td>
<td>
<c:out value="${team.getFG1() }"/>
</td>
<td>
<c:out value="${team.getFG2() }"/>
</td>
<td>
<c:out value="${team.getMisses() }"/>
</td>
</tr>
</c:forEach>
</table>

<form action="/FootballStats/teams" method="post">
Team Name: <input type="text" name="name" size="35">
<br>
<br>
<input type="submit" name="Add Team" value="Add Team">
</form>

<br>
<br>

<c:if test="${team != null }">
<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Offensive Player</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="12"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="Passing Yards" value="Passing Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="Passing Touchdowns" value="Passing Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="Interceptions" value="Interceptions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Passing 2pt Conversions" value="Passing 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="Rushing Yards" value="Rushing Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Rushing Touchdowns" value="Rushing Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="6"></input>
<input type="submit" name="Rushing 2pt Conversions" value="Rushing 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="7"></input>
<input type="submit" name="Receiving Yards" value="Receiving Yards"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="8"></input>
<input type="submit" name="Receiving Touchdowns" value="Receiving Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="9"></input>
<input type="submit" name="Receiving 2pt Conversions" value="Receiving 2pt Conversions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="10"></input>
<input type="submit" name="Fumbles" value="Fumbles"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="11"></input>
<input type="submit" name="Return Touchdowns" value="Return Touchdowns"></input>
</form>
</th>
</tr>

<c:forEach items="${team.off_players }" var="player">
<tr>
<td>
<form action="/FootballStats/pick_off" method="post">
<input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>
</td>
<td>
<c:out value="${player.calculatePoints() }"/>
</td>
<td>
<c:out value="${player.getPass_yds() }"/>
</td>
<td>
<c:out value="${player.getPass_tds() }"/>
</td>
<td>
<c:out value="${player.getPicks() }"/>
</td>
<td>
<c:out value="${player.getPass_2pt() }"/>
</td>
<td>
<c:out value="${player.getRush_yds() }"/>
</td>
<td>
<c:out value="${player.getRush_tds() }"/>
</td>
<td>
<c:out value="${player.getRush_2pt() }"/>
</td>
<td>
<c:out value="${player.getRec_yds() }"/>
</td>
<td>
<c:out value="${player.getRec_tds() }"/>
</td>
<td>
<c:out value="${player.getRec_2pt() }"/>
</td>
<td>
<c:out value="${player.getFumbles() }"/>
</td>
<td>
<c:out value="${player.getRet_tds() }"/>
</td>
</tr>
</c:forEach>
</table>

<form action="/FootballStats/off" method="post">
Player Name: <input type="text" name="name" size="35">
<br>
<br>
<input type="submit" name="Add Offensive Player" value="Add Offensive Player">
</form>

<br>
<br>

<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Defense/Special Teams</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="8"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="Defensive Touchdowns" value="Defensive Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="Defensive Interceptions" value="Defensive Interceptions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="Fumbles Recovered" value="Fumbles Recovered"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Sacks" value="Sacks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="Blocked Kicks" value="Blocked Kicks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Safeties" value="Safeties"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="6"></input>
<input type="submit" name="Points Allowed" value="Points Allowed"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="7"></input>
<input type="submit" name="Yards Allowed" value="Yards Allowed"></input>
</form>
</th>
</tr>

<c:forEach items="${team.def_players }" var="player">
<tr>
<td>
<form action="/FootballStats/pick_def" method="post">
<input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>
</td>
<td>
<c:out value="${player.calculatePoints() }"/>
</td>
<td>
<c:out value="${player.getDef_tds() }"/>
</td>
<td>
<c:out value="${player.getPicks() }"/>
</td>
<td>
<c:out value="${player.getFumbles() }"/>
</td>
<td>
<c:out value="${player.getSacks() }"/>
</td>
<td>
<c:out value="${player.getBlocks() }"/>
</td>
<td>
<c:out value="${player.getSafeties() }"/>
</td>
<td>
<c:out value="${player.getPa() }"/>
</td>
<td>
<c:out value="${player.getYa() }"/>
</td>
</tr>
</c:forEach>
</table>

<form action="/FootballStats/def" method="post">
Player Name: <input type="text" name="name" size="35">
<br>
<br>
<input type="submit" name="Add Defensive Player" value="Add Defensive Player">
</form>

<br>
<br>

<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Kicker</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="PAT Made" value="PAT Made"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="FG Made (0-39)" value="FG Made (0-39)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="FG Made (40-49)" value="FG Made (40-49)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="FG Made (50+)" value="FG Made (50+)"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="FG Missed" value="FG Missed"></input>
</form>
</th>
</tr>

<c:forEach items="${team.kickers }" var="player">
<tr>
<td>
<form action="/FootballStats/pick_kicker" method="post">
<input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>
</td>
<td>
<c:out value="${player.calculatePoints() }"/>
</td>
<td>
<c:out value="${player.getPat() }"/>
</td>
<td>
<c:out value="${player.getFg0() }"/>
</td>
<td>
<c:out value="${player.getFg1() }"/>
</td>
<td>
<c:out value="${player.getFg2() }"/>
</td>
<td>
<c:out value="${player.getMisses() }"/>
</td>
</tr>
</c:forEach>
</table>

<form action="/FootballStats/kicker" method="post">
Player Name: <input type="text" name="name" size="35">
<br>
<br>
<input type="submit" name="Add Kicker" value="Add Kicker">
</form>

<br>
<br>

<c:if test="${off != null }">
<form action="/FootballStats/off_stats" method="post">
Passing Yards: <br><input type="text" name="pass_yds" size="35">
<br>
Passing Touchdowns: <br><input type="text" name="pass_tds" size="35">
<br>
Interceptions: <br><input type="text" name="picks" size="35">
<br>
Passing 2pt Conversions: <br><input type="text" name="pass_2pt" size="35">
<br>
Rushing Yards: <br><input type="text" name="rush_yds" size="35">
<br>
Rushing Touchdowns: <br><input type = "text" name="rush_tds" size="35">
<br>
Rushing 2pt Conversions: <br><input type="text" name="rush_2pt" size="35">
<br>
Receiving Yards: <br><input type="text" name="rec_yds" size="35">
<br>
Receiving Touchdowns: <br><input type="text" name="rec_tds" size="35">
<br>
Receiving 2pt Conversions: <br><input type="text" name="rec_2pt" size="35">
<br>
Fumbles: <br><input type="text" name="fumbles" size="35">
<br>
Return Touchdowns: <br><input type="text" name="ret_tds" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

<c:if test="${def != null }">
<form action="/FootballStats/def_stats" method="post">
Defensive Touchdowns: <br><input type="text" name="def_tds" size="35">
<br>
Defensive Interceptions: <br><input type="text" name="picks" size="35">
<br>
Fumbles Recovered: <br><input type="text" name="fumbles" size="35">
<br>
Sacks: <br><input type="text" name="sacks" size="35">
<br>
Blocked Kicks: <br><input type="text" name="blocks" size="35">
<br>
Safeties: <br><input type = "text" name="safeties" size="35">
<br>
Points Allowed: <br><input type="text" name="pa" size="35">
<br>
Yards Allowed: <br><input type="text" name="ya" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

<c:if test="${kicker != null }">
<form action="/FootballStats/kicker_stats" method="post">
PAT Made: <br><input type="text" name="pat" size="35">
<br>
FG Made (0-39): <br><input type="text" name="fg0" size="35">
<br>
FG Made (40-49): <br><input type="text" name="fg1" size="35">
<br>
FG Made (50+): <br><input type="text" name="fg2" size="35">
<br>
Misses: <br><input type="text" name="misses" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

</c:if>
</body>
</html>